const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const boardSchema = new Schema({
    range: Number,
    name: {
        type: String,
        unique: true
    }
},{timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } });

boardSchema.virtual('units', {
  ref: 'Unit',
  localField: '_id',
  foreignField: 'belong'
});


module.exports = mongoose.model('Board', boardSchema);